package top.infopub.job.quartz.exec;


import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import top.infopub.job.cap.service.PayInterestService;
import top.infopub.job.quartz.exec.base.BaseJob;
import top.infopub.util.DateUtil;
import top.infopub.util.SpringContext;


/**
 * 融资-融资付息，把满足条件的拆分好对应的融资付息明细保存到融资付息明细表中(主表对应新增记录)，并发送OA待办
 *
 */
public class SendPayIntOaToDoJob extends BaseJob {

    private static PayInterestService payInterestService;

    static {
        payInterestService = SpringContext.getBean(PayInterestService.class);
    }

    public SendPayIntOaToDoJob() {}

    @Override
    public void execute(JobExecutionContext context)
        throws JobExecutionException {
        try {
            String start = DateUtil.currentDateDef();
            log.info("SendPayIntOaToDoJob开始时间：{}", start);
            payInterestService.sendOaPayIntToDo();
            String end = DateUtil.currentDateDef();
            log.info("SendPayIntOaToDoJob结束时间：{}", end);
            logSucceed("融资付息发送OA待办执行完成，开始时间：" + start + "，结束时间：" + end);
        }
        catch (Exception e) {
            log.error("开标任务执行error", e);
            logFail(e, true);
        }
    }
}
